import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';

//错误码管理单条查询
export const querySysErrorCode = (params) => {
  params.head.transCode = 'querySysErrorCode';
  return request({
    url: '/platform/sysErrorCode/querySysErrorCode',
    method: 'post',
    data: params
  })
}
//错误码管理多条列表查询，支持条件查询
export const querySysErrorCodeListPage = (params) => {
  params.head.transCode = 'querySysErrorCodeListPage';
  return request({
    url: '/platform/sysErrorCode/querySysErrorCodeListPage',
    method: 'post',
    data: params
  })
}
//错误码管理新增单条记录
export const saveSysErrorCode = (params) => {
  params.head.transCode = 'saveSysErrorCode';
  return request({
    url: '/platform/sysErrorCode/saveSysErrorCode',
    method: 'post',
    data: params
  })
}
//错误码管理新增多条记录
export const saveSysErrorCodeList = (params) => {
  params.head.transCode = 'saveSysErrorCodeList';
  return request({
    url: '/platform/sysErrorCode/saveSysErrorCodeList',
    method: 'post',
    data: params
  })
}
//错误码管理新增或修改单条记录
export const saveOrUpdateSysErrorCode = (params) => {
  params.head.transCode = 'saveOrUpdateSysErrorCode';
  return request({
    url: '/platform/sysErrorCode/saveOrUpdateSysErrorCode',
    method: 'post',
    data: params
  })
}


//错误码管理新增或修改单条记录
export const saveOrUpdateSysErrorCodeList = (params) => {
  params.head.transCode = 'saveOrUpdateSysErrorCodeList';
  return request({
    url: '/platform/sysErrorCode/saveOrUpdateSysErrorCodeList',
    method: 'post',
    data: params
  })
}

//错误码管理修改单条记录
export const updateSysErrorCode = (params) => {
  params.head.transCode = 'updateSysErrorCode';
  return request({
    url: '/platform/sysErrorCode/updateSysErrorCode',
    method: 'post',
    data: params
  })
}

//错误码管理删除单条记录
export const deleteSysErrorCode = (params) => {
  params.head.transCode = 'deleteSysErrorCode';
  return request({
    url: '/platform/sysErrorCode/deleteSysErrorCode',
    method: 'post',
    data: params
  })
}

//错误码管理删除多条记录
export const deleteSysErrorCodeList = (params) => {
  params.head.transCode = 'deleteSysErrorCodeList';
  return request({
    url: '/platform/sysErrorCode/deleteSysErrorCodeList',
    method: 'post',
    data: params
  })
}
//错误码管理导出excel
export const exportSysErrorCodeExcel = (params) => {
  downloadExcel({
    url: '/platform/sysErrorCode/excelDownload/exportSysErrorCodeExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
